home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / DB_CLIPP / 0411.ZIP / NDATE.C < prev    next >
Text File  |  1985-04-08  |  963b  |  40 lines

  1. /*
  2.  * The purpose of this procedure is to return into a string 10
  3.  * characters long the date in the format dd-mmm-yy.
  4.  * dd is a 2 digit decimal figure,
  5.  * mmm is a 3 character string, with the initial character capitalised,
  6.  * yy is a 2 digit decimal figure.
  7.  */
  8. ndate()
  9.     {
  10.     int dmm,
  11.         ddd,
  12.         dyy,
  13.         cntr,
  14.         charcnt;
  15.     char date[9],
  16.          month[4],
  17.          temp,
  18.          s[10];
  19.     dates(date);
  20.     sscanf(date,"%2d %c %2d %c %2d",&dmm,&temp,&ddd,&temp,&dyy);
  21.     charcnt=((dmm-1)*3);
  22.     strncpy(&month,"JanFebMarAprMayJunJulAugSepOctNovDec"+charcnt,3);
  23.     month[3]='\0';
  24.     sprintf(s,"%2d-%3s-%2d",ddd,month,dyy);
  25.     s[9]='\0';
  26.     if (*s==' ')
  27.         {
  28.         *s='0';
  29.         }
  30.     printf("Ndate version = %s.\n",s);
  31.     cntr=0;
  32.     while (cntr<=9)
  33.         {
  34.         temp=*(s+cntr);
  35.         printf("Char %d = %c.\n",cntr,temp);
  36.         ++cntr;
  37.         }
  38.     return(&s);
  39.     }
  40.